package com.pkx.guide.info.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pkx.guide.common.annotation.ORpose;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.pkx.guide.info.entity.TInfoGuideSchemeDetail;
import com.pkx.guide.info.service.TInfoGuideSchemeDetailService;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import com.pkx.guide.common.annotation.Log;
import com.pkx.guide.common.enums.BusinessType;
import lombok.extern.slf4j.Slf4j;

/**
 * 诱导屏方案策略明细表 控制器
 *
 * @author sunsy
 * @since 2023-11-16
 */
@RestController
@RequestMapping("/info/schemeDetail")
@Tag(name = "诱导屏方案策略明细表")
@Slf4j
@ORpose
public class TInfoGuideSchemeDetailController {

    @Autowired
    private TInfoGuideSchemeDetailService tInfoGuideSchemeDetailService;

    @Operation(summary = "诱导屏方案策略明细表分页列表")
    @GetMapping("/page")
    public IPage<TInfoGuideSchemeDetail> page(Page page, TInfoGuideSchemeDetail tInfoGuideSchemeDetail) {
        return tInfoGuideSchemeDetailService.pageList(page,tInfoGuideSchemeDetail);
    }

    @Operation(summary = "诱导屏方案策略明细表列表")
    @GetMapping("/list")
    public List<TInfoGuideSchemeDetail> list(TInfoGuideSchemeDetail tInfoGuideSchemeDetail) {
        return tInfoGuideSchemeDetailService.listByEntity(tInfoGuideSchemeDetail);
    }

    @Operation(summary = "诱导屏方案策略明细表详情")
    @GetMapping(value = "/{id}")
    public TInfoGuideSchemeDetail selectById(@PathVariable("id") Integer id) {
        return tInfoGuideSchemeDetailService.selectById(id);
    }

    @Operation(summary = "诱导屏方案策略明细表新增")
    @PostMapping("/")
    @Log(title = "诱导屏方案策略明细表", businessType = BusinessType.INSERT)
    public Boolean add(@RequestBody TInfoGuideSchemeDetail tInfoGuideSchemeDetail) {
        return tInfoGuideSchemeDetailService.saveTInfoGuideSchemeDetail(tInfoGuideSchemeDetail);
    }

    @Operation(summary = "诱导屏方案策略明细表修改")
    @PutMapping("/")
    @Log(title = "诱导屏方案策略明细表", businessType = BusinessType.UPDATE)
    public Boolean modify(@RequestBody TInfoGuideSchemeDetail tInfoGuideSchemeDetail) {
        return tInfoGuideSchemeDetailService.modify(tInfoGuideSchemeDetail);
    }

    @Operation(summary = "诱导屏方案策略明细表删除(单个条目)")
    @DeleteMapping(value = "/{id}")
    @Log(title = "诱导屏方案策略明细表", businessType = BusinessType.DELETE)
    public Boolean deleteById(@PathVariable("id") Integer id) {
        return tInfoGuideSchemeDetailService.deleteById(id);
    }
}
